package com.chenyun.infra.xxljob.admin.config;//package com.chenyun.infra.xxljob.admin.config;
//
//import com.xxl.job.core.executor.XxlJobExecutor;
//import com.xxl.job.core.executor.impl.XxlJobSpringExecutor;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
//import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
//import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
//import org.springframework.boot.context.properties.EnableConfigurationProperties;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//
//import java.util.Objects;
//
///**
// * xxljob自动装配类
// *
// * @descriptions:
// * @author: Lonni
// * @date: 2021/11/18 9:31
// * @version: 1.0
// */
//@Configuration
//@ConditionalOnClass(XxlJobSpringExecutor.class)
//@ConditionalOnProperty(prefix = "xxl.job", name = "enabled", havingValue = "true", matchIfMissing = true)
//@EnableConfigurationProperties({XxlJobProperties.class})
//@Slf4j
//public class XxlJobConfiguration {
//
//    private final XxlJobProperties properties;
//    public XxlJobConfiguration(XxlJobProperties xxlJobProperties) {
//        this.properties = xxlJobProperties;
//    }
//
//    @Bean
//    @ConditionalOnMissingBean
//    public XxlJobExecutor xxlJobExecutor() {
//        log.info("初始化 XXL-Job 执行器的配置");
//        // 参数校验
//        XxlJobProperties.AdminProperties admin = this.properties.getAdmin();
//        XxlJobProperties.ExecutorProperties executor = this.properties.getExecutor();
//        Objects.requireNonNull(admin, "xxl job admin properties must not be null.");
//        Objects.requireNonNull(executor, "xxl job executor properties must not be null.");
//
//        // 初始化执行器
//        XxlJobExecutor xxlJobExecutor = new XxlJobSpringExecutor();
//        xxlJobExecutor.setIp(executor.getIp());
//        xxlJobExecutor.setPort(executor.getPort());
//        xxlJobExecutor.setAppname(executor.getAppName());
//        xxlJobExecutor.setLogPath(executor.getLogPath());
//        xxlJobExecutor.setLogRetentionDays(executor.getLogRetentionDays());
//        xxlJobExecutor.setAdminAddresses(admin.getAddresses());
//        xxlJobExecutor.setAccessToken(this.properties.getAccessToken());
//        return xxlJobExecutor;
//    }
//
//
//}
